# Create Sharing Scope

Create a new sharing scope. Max 100 sharing scopes are allowed, each covering up to 250 countries.
A sharing scope must not overlap with an existing sharing scope of the storage, otherwise it is rejected with
`400 Bad Request` naming the conflicting sharing scope. Two sharing scopes overlap when they share at least one
Data Source and at least one country; omitted `dataSources` or `countries` cover all of them.
When creating sharing scope, all Business Partners from selection scope which are covered become disclosed.
The following table presents the source for disclosed field.
| Mapping disclosure | Sharing Scope matches | Source for disclosed |
|  --- | --- | --- |
| true | yes | Mapping disclosure |
| true | no | Mapping disclosure |
| false | yes | Sharing Scope |
| false | no | default: false, otherwise from API request up to V4 |

When source for disclosed field is Sharing Scope, the value is determined only during
the creation of a Sharing Scope or Business Partner. Any new update of Business Partner
doesn't overwrite the value of disclosed in the Business Partner. To change the disclosure
of a concrete Business Partner, it has to be [requested directly](https://developer.cdq.com/apis/data-exchange-api/api-v5/business-partners/paths/~1v3~1storages~1%7Bstorageid%7D~1businesspartners~1updatedisclosure/post).
> #### Note
Business Partners with the Business Partner profile tag `MARKED_FOR_DELETION` are excluded from sharing and are not considered during Sharing Scope processing.

Endpoint: POST /v4/storages/{storageId}/sharingscopes
Version: 5
Security: apiKey

## Security:

  - `apiKey` (unknown)
    apiKey in header X-API-KEY

## Path parameters:

  - `storageId` (string, required)
    Unique identifier of the Storage.

## Request fields (application/json):

  - `description` (string)
    Description of defined sharing scope provided by customer
    Example: Share customers from France.

  - `dataSources` (array)
    List of Data Sources. When empty or omitted, the sharing scope covers all Data Sources.

  - `dataSources.id` (string, required)
    Unique identifier for a Data Source of the Storage.
    Example: 648824a691d8d2503d65103e

  - `countries` (array)
    List of Countries. When empty or omitted, the sharing scope covers all countries.

  - `countries.shortName` (string, required)
    Country code (ISO 3166-1 alpha-2).
    Example: CH

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier for the Sharing Scope.
    Example: bfdfd6f7-562f-4d4a-921f-e68cba60d5cf

  - `description` (string)
    Description of defined sharing scope provided by customer
    Example: Share customers from France.

  - `dataSources` (array)
    List of Data Sources.

  - `dataSources.id` (string)
    Unique identifier for a Data Source of the Storage.
    Example: 648824a691d8d2503d65103e

  - `dataSources.name` (string)
    Name of a data source of a storage.
    Example: Internal customers

  - `countries` (array)
    List of Countries.

  - `countries.shortName` (string)
    Country code (ISO 3166-1 alpha-2).
    Example: CH

  - `excludedCountries` (array)
    List of excluded Countries. When set, the sharing scope covers all countries except these. Business Partners with any address in an excluded country are not covered; Business Partners without a country are covered. Mutually exclusive with `countries`.

  - `applyingJob` (object)
    Job that is currently applying the sharing scope.

  - `applyingJob.id` (string)
    Unique identifier of a job.
    Example: 35f23c03-1c22-45fe-9484-3ffe769325de

  - `applyingJob.status` (string)
    Job execution status.
    Example: RUNNING

  - `applyingJob.progress` (integer)
    Progress (%) of the job.
    Example: 77

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 200 examples:

  - `Create Sharing Scope for FR Business Partners` (unknown)

  - `Create Sharing Scope Template` (unknown)

